/*********************************************************************************
Organization 					: 				Georgia Institute of Technology
  
Institute 						:				Cognitive Computing Group(CCL)
 
Authors							: 				Santiago Ontanon
 												
Class							:				CBR
 
Function						: 				The class contains the main Case Based
												Reasoning Module. 
*********************************************************************************/
package cbr;


import java.io.PrintStream;

import planninglanguage.goals.Goal;
import planninglanguage.plans.Plan;
import base.CBLILRModule;
import base.WargusGameState;

public class CBR extends CBLILRModule {
	public static final int DEBUG_LEVEL = 0;	// 0: silent, 1: some messages, 2: verbose
	   
    public static PrintStream m_logger = null;
    public static PrintStream m_experimentsLogger = null;
	
	public CBR() {		
	}
	
	/*
	 * Runs the CBR module
	 */
	public void run() {
		
		if (DEBUG_LEVEL>=1) System.out.println("CBR started");
	}
	
	
	/*
	 * Tells the CBR that a new game is going to start. This method can be used
	 * to clear any tomperary data the CBR system might want to store during the game play
	 */
	public void reset() {
		
	}
		
	/*
	 * Tells the CBR that to save the current case base to disk
	 */
	public void save() {
		
	}
	

	/*
	 * Retain a case base object based on successful execution of the 
	 * case base after successul adaptation
	 */
	public void retain(Plan a_p, float success, long a_time)
	{
		
	}
	
	
	/*
	 * Retreive the best plan from the Plan library that is similar to a given goal 
	 * and a current gamestate. This plan and the contained list of basic actions 
	 * is used by the run time execution (the MRE class) to send commands to the Wargus/Stratagus 
	 * engine
	 */
	public Plan retrieveCases (Goal a_g, WargusGameState a_gamestate) throws Exception
	{
         return null;
	}
	
	
	/*
	 * Adapt the Plan retrieved from the plan library to the current game 
	 * state so that the plan is specific to the current game situation 
	 */
	public Plan adaptPlan(Plan a_p,WargusGameState a_gamestate,int playerID) throws Exception
	{
		return a_p;
	}
	
	
	protected void finalize() throws Throwable {
		CBRAdaptation.m_logger = null;
		m_logger.close();		
	}

}